﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;

namespace ConsoleApp1.DbCustom.Models
{
    [Index(nameof(Author), Name = "Index_1")]
    public partial class Blog_Info
    {
        public Blog_Info()
        {
            Blog_Collect = new HashSet<Blog_Collect>();
            Blog_Comment = new HashSet<Blog_Comment>();
            Blog_PersonCategory_Map = new HashSet<Blog_PersonCategory_Map>();
            Blog_PersonLabel_Map = new HashSet<Blog_PersonLabel_Map>();
        }

        [Key]
        [StringLength(36)]
        [Unicode(false)]
        public string Id { get; set; } = null!;
        [StringLength(36)]
        [Unicode(false)]
        public string Author { get; set; } = null!;
        /// <summary>
        /// 1 随笔
        ///    2 文章
        ///    3 日记
        /// </summary>
        public int Category { get; set; }
        [StringLength(200)]
        public string Title { get; set; } = null!;
        [Column(TypeName = "ntext")]
        public string Content { get; set; } = null!;
        public bool? IsPublish { get; set; }
        public bool? AllowComment { get; set; }
        public bool? IsTop { get; set; }
        /// <summary>
        /// 1 公开
        ///    2 仅登录用户
        ///    3 只有我
        /// </summary>
        public int? WhoVisit { get; set; }
        public bool? IsDel { get; set; }
        [Column(TypeName = "datetime")]
        public DateTime? TopTime { get; set; }
        [Column(TypeName = "datetime")]
        public DateTime? DelTime { get; set; }
        [StringLength(36)]
        [Unicode(false)]
        public string? CreatedBy { get; set; }
        [Column(TypeName = "datetime")]
        public DateTime? CreatedTime { get; set; }
        [StringLength(36)]
        [Unicode(false)]
        public string? LastModifiedBy { get; set; }
        [Column(TypeName = "datetime")]
        public DateTime? LastModifiedTime { get; set; }

        [ForeignKey(nameof(Author))]
        [InverseProperty(nameof(Sys_User.Blog_Info))]
        public virtual Sys_User AuthorNavigation { get; set; } = null!;
        [InverseProperty("Blog")]
        public virtual Blog_Interest Blog_Interest { get; set; } = null!;
        [InverseProperty("Blog")]
        public virtual ICollection<Blog_Collect> Blog_Collect { get; set; }
        [InverseProperty("Blog")]
        public virtual ICollection<Blog_Comment> Blog_Comment { get; set; }
        [InverseProperty("Blog")]
        public virtual ICollection<Blog_PersonCategory_Map> Blog_PersonCategory_Map { get; set; }
        [InverseProperty("Blog")]
        public virtual ICollection<Blog_PersonLabel_Map> Blog_PersonLabel_Map { get; set; }
    }
}
